import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        // 首页
        {
            path: '/',
            name: 'Home',
            component: () => import('../views/Home/index.vue'),
            meta: {
              isLogin: false,
              isFooter: true
            }
        },

        // 分类
        {
          path: '/category',
          name: 'Category',
          component: () => import('../views/Category/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 购物车
        {
          path: '/cart',
          name: 'Cart',
          component: () => import('../views/Cart/index.vue'),
          meta: {
            isLogin: true,
            isFooter: true
          }
        },

        // 我的
        {
          path: '/me',
          name: 'Me',
          component: () => import('../views/Me/index.vue'),
          meta: {
            isLogin: true,
            isFooter: true
          }
        },

        // 推荐
        {
          path: '/recommend',
          name: 'Recommend',
          component: () => import('../views/Recommend/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 用户注册
        {
          path: '/register',
          name: 'Register',
          component: () => import('../views/Register/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 找回密码
        {
          path: '/forgotPassword',
          name: 'ForgotPassword',
          component: () => import('../views/ForgotPassword/index.vue'),
          meta: {
            isLogin: false,
            isFooter: true
          }
        },

        // 密码登录
        {
          path: '/passwordLogin',
          name: 'PasswordLogin',
          component: () => import('../views/Login/passwordLogin.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // 短信登录
        {
          path: '/messageLogin',
          name: 'MessageLogin',
          component: () => import('../views/Login/messageLogin.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // 收货地址
        {
          path: '/deliveryAddress',
          name: 'DeliveryAddress',
          component: () => import('../views/DeliveryAddress/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 个人设置
        {
          path: '/userSet',
          name: 'UserSet',
          component: () => import('../views/UserSet/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 其他信息
        {
          path: '/otherInfo',
          name: 'OtherInfo',
          component: () => import('../views/UserSet/otherInfo.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 意见反馈
        {
          path: '/feedback',
          name: 'Feedback',
          component: () => import('../views/Feedback/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 修改昵称
        {
          path: '/editNick',
          name: 'EditNick',
          component: () => import('../views/UserSet/editNick.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 修改手机号
        {
          path: '/editMobile',
          name: 'EditMobile',
          component: () => import('../views/UserSet/editMobile.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 修改邮箱
        {
          path: '/editEmail',
          name: 'EditEmail',
          component: () => import('../views/UserSet/editEmail.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

         // 修改邮箱
         {
          path: '/changePassword',
          name: 'ChangePassword',
          component: () => import('../views/UserSet/changePassword.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 商品列表
        {
          path: '/goodsList',
          name: 'GoodsList',
          component: () => import('../views/GoodsList/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

         // 商品搜索
         {
          path: '/goodsSearch',
          name: 'GoodsSearch',
          component: () => import('../views/GoodsSearch/index.vue'),
          meta: {
            isLogin: false,
            isFooter: false
          }
        },

        // 店铺收藏
        {
          path: '/shopCollect',
          name: 'ShopCollect',
          component: () => import('../views/ShopCollect/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 足迹
        {
          path: '/footprint',
          name: 'Footprint',
          component: () => import('../views/Footprint/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 商品收藏
        {
          path: '/goodsCollect',
          name: 'GoodsCollect',
          component: () => import('../views/GoodsCollect/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },


        // 关注商品
        {
          path: '/goodsFollow',
          name: 'GoodsFollow',
          component: () => import('../views/GoodsFollow/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 商品详情
        {
          path: '/goodsDetail',
          name: 'GoodsDetail',
          component: () => import('../views/GoodsDetail/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 商品评价
        {
          path: '/goodsEvaluate',
          name: 'GoodsEvaluate',
          component: () => import('../views/GoodsEvaluate/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 订单列表
        {
          path: '/orderList',
          name: 'OrderList',
          component: () => import('../views/OrderList/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 订单列表
        {
          path: '/refundOrder',
          name: 'RefundOrder',
          component: () => import('../views/RefundOrder/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 订单详情
        {
          path: '/orderDetail',
          name: 'OrderDetail',
          component: () => import('../views/OrderDetail/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 确认订单
        {
          path: '/confirmOrder',
          name: 'ConfirmOrder',
          component: () => import('../views/ConfirmOrder/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },

        // 订单支付结果页
        {
          path: '/paymentResult',
          name: 'PaymentResult',
          component: () => import('../views/PaymentResult/index.vue'),
          meta: {
            isLogin: true,
            isFooter: false
          }
        },
    ],
    // 路由滚动行为
    scrollBehavior (to, from, savedPosition) {
      return {
        top: 0
      }
    }
  })
  
  export default router